package cn.edu.sgu.www.shell.command;

import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import org.springframework.shell.standard.ShellComponent;
import org.springframework.shell.standard.ShellMethod;
import org.springframework.shell.standard.ShellOption;

//import javax.validation.constraints.Max;
//import javax.validation.constraints.Min;

/**
 * @author heyunlin
 * @version 1.0
 */
@ShellComponent
public class Commands {

    @ShellMethod("初始化项目环境。")
    public String init() {
        // todo

        return "初始化项目环境完成...";
    }



    @ShellMethod("计算两个整数的和。")
    public int add(int a, int b) {
        return a + b;
    }

    @ShellMethod("打招呼：")
    public String greet(@ShellOption(defaultValue = "沐雨橙风ιε") String name) {
        return "Hello " + name;
    }

    @ShellMethod("计算平方数。")
    public int sqrt(@Min(value = 1) @Max(value = 99) int n) {
        return n * n;
    }

}